package com.zw.web.oss.controller;


import com.zw.web.oss.service.FileUploadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping("/upload")
@Slf4j
public class FileUploadController {
    @Resource
    private FileUploadService fileUploadService;

    @PostMapping("/images")
    public String uploadImage(MultipartFile file) {
        return fileUploadService.upload(file);
    }

    @GetMapping("/log")
    public String testLog() {
        log.info("正常的日志信息");
        log.error("错误的日志信息");
        return "测试日志";
    }
}

